function getShippinFare()
{
	shipping_zip_code = $('shipping_zip_code').value;
	shipping_city = $('shipping_city').value;
	
	if (shipping_zip_code.trim() != '' && shipping_city.trim() != '') {
		params = shipping_zip_code + '/';
		params += shipping_city + '/';
		params += $('shipping_country_id').value + '/';
		params += $('selService').value + '/';
		params += $('items_weight').value;
		
		//alert(params);
		ajax(baseUrl+"ajax/getshippingfare/" + params, 'script');
	}
	else
	{
		alert('Shipping Zip Code and Shipping City is empty!');
	}
	
	return false;
}
function getZones(country_id, domID)
{
	ajax(baseUrl+"ajax/getzones/"+country_id+"/"+domID, 'update', domID+"-zones");
}
function copy_shipping_address()
{
	$('billing_address_1').value = $('shipping_address_1').value;
	$('billing_address_2').value = $('shipping_address_2').value;
	$('billing_city').value = $('shipping_city').value;
	$('billing_zip_code').value = $('shipping_zip_code').value;
	
	objSelect = $('billing_country_id');
	objSelect[$('shipping_country_id').selectedIndex].selected = true;
	
	//alert($('shipping-zones').innerHTML);
	$('billing-zones').innerHTML = $('shipping-zones').innerHTML.replace(/shipping_zone_id/g, "billing_zone_id");
	
	objSelect = $('billing_zone_id');
	objSelect[$('shipping_zone_id').selectedIndex].selected = true;

}
function checkPONumber(ponumber)
{
	if(/.+/.test(ponumber))
	{
		ajax(baseUrl+"ajax/checkponumber/"+ponumber, 'script');
	}
	
	return false;
}
function addToCart(product_id, quantity)
{
	if($('quantity').value <= parseInt(quantity)) 
	{
		if (/^\d+$/.test($('quantity').value)) 
		{
			ajax(baseUrl+"cart/add/" + product_id + "/" + $('quantity').value, 'script');
		}
		else 
		{
			alert('请输入数量！');
			$('quantity').focus();
		}
	}
	else
	{
		alert('Out of stock, please contact us for back order.');
	}
	
	return false;
}